import { ref } from 'vue';
import { cardBankListQuery } from '@/common/api/bankCard';
import type { ColumnsItem } from '@/types/pricker';

export function useBankList() {
  const bankList = ref<ColumnsItem[]>([]);
  const onLoad = async () => {
    try {
      const res = await cardBankListQuery({});
      if (res.result.list?.length) {
        bankList.value = res.result.list.map((v: any) => ({ text: v.bank_name, value: v.bank_name }));
      }
    } catch {
      /** empty */
    }
  };
  onLoad();

  return { bankList };
}
